<?php
class Crypt
{
    public $ci;
    public function __construct()
    {
        $this->ci =& get_instance();
        //$this->cipher = MCRYPT_RIJNDAEL_256;
        $this->cipher = MCRYPT_DES;
        $this->mode = MCRYPT_MODE_ECB;
    }

    public function encrypt($key, $data)
    {
        $result = mcrypt_encrypt($this->cipher, $key, $data, $this->mode);
        return base64_encode($result);
    }

    public function decrypt($key, $data)
    {
        return mcrypt_decrypt($this->cipher, $key, base64_decode($data), $this->mode);
    }
}
?>
